Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

konan

Package Overview
Dependencies
Maintainers
2
Versions
10
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

konan

find all `require` `import` calls by walking the AST

  • 2.1.1
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
2
Created
Source

konan

NPM version NPM downloads Build Status donate

Like detective but also supports ES6 import and more.

Install

yarn add konan
# or hey old school
npm install --save konan

Supported syntax

  • require call
  • import/export ES6 modules
  • import() Dynamic import
  • You can use all language features supported by babel parser, including jsx syntax by default

Usage

const konan = require('konan')

konan(`
import React, {Component} from 'react'
const vue = require('vue/dist/vue')
import('./my-async-module').then()
require(path.resolve('./'))
`)
/*
result =>
{
  strings: ['react', 'vue/dist/vue', './my-async-module'],
  expressions: ['path.resolve(\'./\')']
}
*/

API

konan(input, [options])

input

Type: string object
Required: true

Source content as string or AST tree.

options
dynamicImport

Type: boolean
Default: true

You can disable detecting dynamic import()-ed modules.

parse

Type: object
Default: {sourceType: 'module', plugins: ['jsx', 'typescript', 'dynamicImport']}

babel parser parse options.

FAQ

What does konan stand for?

It stands for Meitantei Konan (名探偵コナン), the main character in Detective Conan.

Contributing

  1. Fork it!
  2. Create your feature branch: git checkout -b my-new-feature
  3. Commit your changes: git commit -am 'Add some feature'
  4. Push to the branch: git push origin my-new-feature
  5. Submit a pull request :D

Author

konan © egoist, Released under the MIT License.
Authored and maintained by egoist with help from contributors (list).

egoistian.com · GitHub @egoist · Twitter @_egoistlily

FAQs

Package last updated on 15 Jul 2020

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc